﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace Vanfa.Web.control
{
    public partial class wucUserIconUpload : System.Web.UI.UserControl
    {
        public string IconPath
        {
            get { return hidIconPath.Value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lbtnUploadIcon_Click(object sender, EventArgs e)
        {
            var hIcon = "userIcon" + DateTime.Now.ToString("yyMMddHHmmss");
            FileInfo fi = new FileInfo(fpHeaderIcon.FileName);
            hIcon += fi.Extension;
            var p = Server.MapPath("~/upload/header/icon") + "\\" + hIcon;
            fpHeaderIcon.SaveAs(p);
            hidIconPath.Value = "/upload/header/icon/" + hIcon;
            imgIcon.ImageUrl = hidIconPath.Value;
        }
    }
}